package com.wordlearning.app.repository;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.wordlearning.app.entity.WordSet;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Optional;

@Mapper
public interface WordSetRepository extends BaseMapper<WordSet> {

    public List<WordSet> findByUserId(Long userId);
    
    public boolean existsByNameAndUserId(String name, Long userId);
    
    // 根据ID查询单词集
    public Optional<WordSet> selectById(Long id);
    
    // 查询所有单词集
    public List<WordSet> selectList();
    
    // 批量查询单词集
    public List<WordSet> selectBatchIds(List<Long> ids);
    
    // 新增单词集
    public int insert(WordSet wordSet);
    
    // 更新单词集
    public int updateById(WordSet wordSet);
    
    // 删除单词集
    public int deleteById(Long id);
    
    // 批量删除单词集
    public int deleteBatchIds(List<Long> ids);
    
    // 根据名称模糊查询单词集
    public List<WordSet> searchWordSets(@Param("keyword") String keyword, @Param("limit") int limit, @Param("offset") int offset);

}